{extend name="$index_style_layout" /}

<!--SEO相关-->
{block name="head_title"}{$fid?($info['seo_title']?:$info['name']):$m_info['title']}{/block}
{block name="head_keword"}{$fid?($info['seo_keywords']?:$info['name']):$m_info['title']}{/block}
{block name="head_description"}{$info.seo_description}{/block}

{block name="body_content"}
<style type="text/css">
.Lists .title a.choose{
	color:red;
}
</style>
<link rel="stylesheet" href="__STATIC__/index/default/list.css">
<script src='__STATIC__/js/iscroll.js'></script>
<div class="ListMainCont">

	<div class="SortBoxCont">
		<ul>
			<li class="{$type==0?'ck':''}"><a href="?type=0&mid={$mid}">播放记录</a></li>
			<li class="{$type==1?'ck':''}"><a href="?type=1&mid={$mid}">我的收藏</a></li>
		</ul>
	</div>
	<div class="ListArticles">

			<!-- 视频模型 -->
			<center>{:fun('Player@play',$listdb[0]['url'],'100%','250px')}</center><br>

	{volist name="$listdb" id="rs"}
		<div class="Lists listdiv_{$key}">
			<div class="title"><a {if $i==1}class="choose"{/if} href="{:urls('content/show',['id'=>$rs['aid']])}?sid={$rs.sid}">{$rs.title|get_word=100}</a></div>
			<ul>
				<li>主题：《{$rs['info']['title']}》 <i onclick="del_fav({$rs.aid},{$rs.sid},{$key})" class="glyphicon glyphicon-remove-circle"></i></li>
			</ul>
		</div>
	{/volist}
	</div>
	 
</div>

<script type='text/javascript'>
var mv_index = 0;
var url_array = [ 
	{volist name="$listdb" id="rs"} 
		{
			url:'{$rs.url}',
			play_time:{$rs.playtime},
			info_id:"{$rs.aid}",
			info_sid:"{$rs.sid}",
			info_page:"{:urls('content/show',['id'=>$rs['aid']])}?sid={$rs.sid}",
		}, 
	{/volist} 
	];
function change_play(index){
	mv_index = index;
	layer.msg("请稍候,视频加载中...");
	player1.newVideo({autoplay:true,video:url_array[index].url});

	$(".Lists .title a").removeClass('choose');
	$(".Lists").eq(index).find(".title a").addClass('choose');
}

//监听播放器状态
function loadedHandler1(){
	player1.addListener('loadedmetadata', function(){
		player1.videoSeek(url_array[0].play_time);
		player1.videoPlay();	//自动播放
	});

	player1.addListener('ended', function(){	//当前播放完毕,播放下一个
		mv_index++;
		if(typeof(url_array[mv_index])!='undefined'){
			change_play(mv_index);
			check_power(mv_index);
		}else{
			layer.alert("全部播放完毕了!");
		}		
	});
}


function del_fav(id,sid,i){	//从库中删除
	var url="{:urls('wxapp.fav/delete')}?type={$type}&id="+id+"&sid="+sid;
	$.get(url,function(res){
		if(res.code==0){
			layer.msg('成功移除');
			$(".listdiv_"+i).remove();
		}else{
			layer.alert(res.msg);
		}
	})
}
</script>
<!--用到的JS-->
{include file="fav/inc"}

{/block}